import os

from config.config import Config


def load_config():
    """
    Load a config class
    """
    mode = os.environ.get('SANIC_ENV', 'DEV')
    # 读取配置文件“app-dev.properties”
    properties_file = "app-dev.properties" if mode.upper() == "DEV" else "app.properties"
    config = Config.load_config(os.path.join(Config.BASE_DIR, "config", properties_file))
    config.update({"AUTO_RELOAD": True if mode.upper() == "DEV" else False})
    return config

CONFIG = load_config()

